"use strice";

const Controller = require('../common/shop')

class ShopController extends Controller {

  tableName = 'shop'
  async shopInfo() {
    let siteId = await this.getSiteId()
    let result = await this.consult({ site_id: siteId[0].site_id });
    console.log("查询", result[0]);
    this.resData(0, "成功", result[0])


  }
  async adressInfo() {
    let siteId = await this.getSiteId()
    let shoplist = await this.consult({ site_id: siteId[0].site_id });
    this.tableName = "site";
    let sitelist = await this.consult({ site_id: siteId[0].site_id });
    let result = shoplist.push(...sitelist);
    console.log(result)
    this.resData(0, "地址信息获取成功", result);
  }

  async shopEdit() {
    let siteId = await this.getSiteId()
    let site_id = siteId[0].site_id

    let result = await this.update(this.ctx.request.body , { site_id })
    console.log(result);
    this.resData(0, "修改成功", null)

  }

}

module.exports = ShopController